const conn = require('../data/lyd_backstage');
module.exports.lyd_approval = (req, res) => {
    if (!req.session.isgaoyuan) {
        res.redirect('/gy_login');
        return;
    }
    res.render('lyd_approval');
}
// 显示数据
module.exports.lyd_fromshow = (req,res)=>{
    conn.query('select * from lyd_adduser',(error,results) =>{ 
        if(error) { 
            return console.log(error);
        }
        res.json(results);
    })
}
// 删除
module.exports.lyd_fromdelete = (req,res)=>{
    // console.log(req.query.id);
    
    conn.query('delete from lyd_adduser where id = ?', req.query.id,(error,results)=>{
        if(error){
            return console.log(error);
        }
        res.json({
            code:'1001',
            message:'删除成功'
        })
    })
}
